using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Net.Mail;


    public partial class AnonymousUser_Contact : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            
        }
        protected void onClick(object sender, EventArgs e)
        {
            // Code for sending the data the user typed in as an email to yourself.
            String strFname = txtFirstName.Text;
            String strLname = txtLastName.Text;
            String strEmail = txtEmail.Text;
            String strAddress = txtAddress.Text;
            String strCity = txtCity.Text;
            String strState = txtState.Text;
            String strZipCode = txtZipCode.Text;
            String strTelephone = txtTelephone.Text;

            try
            {
                MailMessage emailMsg = new MailMessage();
                emailMsg.From = new MailAddress("scrcomments@gmail.com");
                emailMsg.To.Add(new MailAddress(strEmail));
                emailMsg.Subject = "New message from online user";
                emailMsg.Body = "<html><body>First Name: " + strFname + "<br />"
                                + "Last Name: " + strLname + "<br />Email: " + strEmail + "<br />"
                                + "Address: " + strAddress + "<br />City: " + strCity + "<br />"
                                + "State: " + strState + "<br />Zip Code: " + strZipCode + "<br />"
                                + "Telephone: " + strTelephone
                                + "</body></html>";
                emailMsg.IsBodyHtml = true;
                emailMsg.Priority = MailPriority.High;
                SmtpClient MailClient = new SmtpClient("mail.gmail.com");
                MailClient.Credentials = new System.Net.NetworkCredential("scrcomments", "capstoneonly");
                MailClient.Send(emailMsg);

                lblMessage.Text = "Your comment sent successfully! <br/> A representative will contact you shortly.";
            }
            catch
            {
                lblMessage.Text = "Error! Unable to send comments at this time.";
            }
        }

    }
